﻿using System.Web.Script.Serialization;
using NUnit.Framework;
using WeBlog.Models;

namespace WeBlog.Tests.Services
{
    [TestFixture]
    public class SiteConfigurationShould
    {
		[Test]
		public void HaveIdentity()
		{
			var siteConfiguration1 = new SiteConfiguration();
			var siteConfiguration2 = new SiteConfiguration();
			var siteConfiguration3 = _TrickyClone(siteConfiguration1);

			Assert.AreEqual(siteConfiguration1, siteConfiguration3);
			Assert.AreNotEqual(siteConfiguration1, siteConfiguration2);
		}

		private SiteConfiguration _TrickyClone(SiteConfiguration siteConfigurationToClone)
		{
			var serializer = new JavaScriptSerializer();
			var content = serializer.Serialize(siteConfigurationToClone);
			return serializer.Deserialize<SiteConfiguration>(content);
		}
    }
}
